package com.smforj.ssm.modules.sys.domain;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

import com.smforj.ssm.frame.core.bean.PageBean;
import com.smforj.ssm.modules.lib.domain.IUser;

/***
 * User 用户对象 登陆系统manager
 * 一个用户包含多个角色信息与多个Module信息
 * 
 * @author Haijun Gao 
 * @date 2016-7-31 上午10:23:56
 * @desp http://www.cnblogs.com/saga5998/
 * @email 573107773@qq.com
 */
public class SysUser extends PageBean implements IUser{

	/**
	 * @fields serialVersionUID 
	 */
	private static final long serialVersionUID = 3660184499862071843L; 
	
	private String userName;
	private String password;
	private String nickname; 
	private String wechat;
	private String phone;
	private String email; 
	private String remark;
	private String departid; 
	
	private List<Role> roles;
	//private List<Module> module;
	//private List<Permit> permit;
	
 
	public String getUserName() {
		return userName;
	} 
	public void setUserName(String userName) {
		this.userName = userName;
	}  
	public String getPassword() {
		return password;
	} 
	public void setPassword(String password) {
		this.password = password;
	} 
	public String getNickname() {
		return nickname;
	} 
	public void setNickname(String nickname) {
		this.nickname = nickname;
	} 
	public String getWechat() {
		return wechat;
	} 
	public void setWechat(String wechat) {
		this.wechat = wechat;
	} 
	public String getPhone() {
		return phone;
	} 
	public void setPhone(String phone) {
		this.phone = phone;
	} 
	public String getEmail() {
		return email;
	} 
	public void setEmail(String email) {
		this.email = email;
	} 
	public String getRemark() {
		return remark;
	} 
	public void setRemark(String remark) {
		this.remark = remark;
	}  
	public String getDepartid() {
		return departid;
	} 
	public void setDepartid(String departid) {
		this.departid = departid;
	} 
	@Override
	public String toString() {
		return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
	}  
	
	private Map<String,Object> map = new HashMap<String,Object>(); 
	@Override
	public void set(String key, Object value) {  
		if(!map.containsKey(key))
			map.put(key, value);
	}
	@Override
	public void update() { 
		
	}
	/***
	 * get one to many role
	 * @return
	 * @date 2017-5-8 下午4:13:04
	 */
	public List<Role> getRoles() {
		return roles;
	}
	/***
	 * set one to many role
	 * @param roles
	 * @date 2017-5-8 下午4:13:20
	 */
	public void setRoles(List<Role> roles) {
		this.roles = roles;
	}
/*	public List<Permit> getPermit() {
		return permit;
	}
	public void setPermit(List<Permit> permit) {
		this.permit = permit;
	}  
	public List<Module> getModule() {
		return module;
	}
	public void setModule(List<Module> module) {
		this.module = module;
	}*/
	@Override
	public Object get(String key) { 
		if(!map.containsKey(key)) 
			return null;
		return map.get(key);
	}
}
